import { GroupEntity } from "./GroupEntity";
import { PathEntity } from "./PathEntity";
import { SpriteEntity } from "./SpriteEntity";
import { SvgEntity } from "./SvgEntity";
import { TextEntity } from "./TextEntity";

// 工厂类
export class EntityFactory {
    private static classMap: { [key: string]: any } = {
        SpriteEntity,
        GroupEntity,
        PathEntity,
        SvgEntity,
        TextEntity
    };

    static createEntity<T>(className: string, ...args: any[]):T {
        const EntityClass = this.classMap[className];
        if (!EntityClass) {
            throw new Error(`Class "${className}" not found.`);
        }
        return new EntityClass(...args);
    }
}
